package test05;

import java.sql.*;

public class t2_3 {
    public static void main(String[] args) throws SQLException {
        //1.获取连接
        Connection con = DBUtils.getConnection();
        //2.获取Statement对象
        Statement statement = con.createStatement();
        //3.执行查询
        ResultSet resultSet = statement.executeQuery("select * from employee where salary between 8000 and 16000");
        //4.处理结果集
        while(resultSet.next()){
            int id = resultSet.getInt("id");
            String name = resultSet.getString("name");
            String gender = resultSet.getString("gender");
            double salary = resultSet.getDouble("salary");
            double bonus = resultSet.getDouble("bonus");
            Date join_date = resultSet.getDate("join_date");
            System.out.println(id + "," + name + "," + gender + "," + salary + "," + bonus + "," + join_date);
        }
        //5.释放资源
        DBUtils.close(con,statement,resultSet);
    }
}
